package com.hksj.sglm.controller;

import com.hksj.common.core.model.Rest;
import com.hksj.sglm.dto.SpecialGasCockpitDTO;
import com.hksj.sglm.service.SpecialGasCockpitLeftService;
import com.hksj.sglm.vo.SpecialGasInAlarmNumVO;
import com.hksj.sglm.vo.SpecialGasAlarmNumGroupRankingVO;
import com.hksj.sglm.vo.SpecialGasDeviceOverviewVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author fjt
 * @data 2024/9/12 18:20
 * @describe 特气泄漏驾驶舱左侧
 */
@Api(tags = "特气泄漏-驾驶舱左侧")
@RestController
@RequestMapping("/api/sglm/cockpitLeft")
public class SpecialGasCockpitLeftController {

    @Autowired
    private SpecialGasCockpitLeftService specialGasCockpitLeftService;


    @PostMapping("/overView")
    @ApiOperation(value = "设备概览", notes = "设备概览",response = SpecialGasDeviceOverviewVO.class)
    public Rest<List<SpecialGasDeviceOverviewVO>> deviceOverView(@RequestBody SpecialGasCockpitDTO dto){
        return Rest.ok(specialGasCockpitLeftService.deviceOverView(dto));
    }


    @PostMapping("/currentAlarmNum")
    @ApiOperation(value = "统计设备当前报警数量", notes = "统计设备当前报警数量",response = SpecialGasInAlarmNumVO.class)
    public Rest<SpecialGasInAlarmNumVO> currentAlarmNum(@RequestBody SpecialGasCockpitDTO dto){
        return Rest.ok(specialGasCockpitLeftService.currentAlarmNum(dto));
    }


    @PostMapping("/alarmNumRanking")
    @ApiOperation(value = "报警数量排名(最近7天)", notes = "报警数量排名(最近7天)",response = SpecialGasAlarmNumGroupRankingVO.class)
    public Rest<List<SpecialGasAlarmNumGroupRankingVO>> alarmNumRanking(@RequestBody SpecialGasCockpitDTO dto){
        return Rest.ok(specialGasCockpitLeftService.alarmNumRanking(dto));
    }


}
